<template>
    <!-- <navigator :url="`/pages/news_detail/news_detail?id=${newsId}&userId=${userId}`"> -->
	<view class="" @click="tiaoz(newsId,userId)">
        <view class="news-card flex bg-white1 px-[20rpx] py-[32rpx]">
            <view class="mr-[20rpx]" v-if="item.fming">
                <u-image :src="item.fming" width="220" height="200"></u-image>
            </view>
            <!-- <view class="news-card-content flex flex-col justify-between flex-1"> -->
			<view style="width: 65%;">
                <!-- <view class="news-card-content-title text-lg font-medium">{{ item.title }}</view> -->
				<view class="card-titel">{{ item.name }}</view>
				<view class="gui">
					<view class="gui-item">
						规格：
					</view>
					<view class="huanhang">
						{{item.specifications}}
					</view>
				</view>
				<view class="gui">
					<view class="gui-item1">
						交货地：
					</view>
					<view class="huanhang">
						{{item.producer}}
					</view>
				</view>
				<view class="phone">
					<view class="">
						联系方式：
					</view>
					<view class="">
						{{item.contacts[0].tel}}
						<!-- {{item.contacts}} -->
					</view>
				</view>
             <!--   <view class="news-card-content-intro text-gray-400 text-sm mt-[16rpx]">
                    {{ item.desc }}
                </view> -->

               <!-- <view class="text-muted text-xs w-full flex justify-between mt-[12rpx]">
                    <view>{{ item.create_time }}</view>
                    <view class="flex items-center">
                        <image
                            src="/static/images/icon/icon_visit.png"
                            class="w-[30rpx] h-[30rpx]"
                        ></image>
                        <view class="ml-[10rpx]">{{ item.click }}</view>
                    </view>
                </view> -->
            </view>
        </view>
    <!-- </navigator> -->
	</view>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { onLoad, onShow, onReady } from '@dcloudio/uni-app'
	import { useUserStore } from '@/stores/user'
	import { storeToRefs } from 'pinia'
	const userStore = useUserStore()
	const { userInfo, isLogin } = storeToRefs(userStore)
const props = withDefaults(
    defineProps<{
        item: any
        newsId: number,
		userId:number
    }>(),
    {
        item: {},
        newsId: '',
		userId:''
    }
)
onLoad(() => {
    // getData()
	// item.contacts=JSON.parse(item.contacts)
})
const tiaoz=(id,user_id)=>{
	// console.log();
	// console.log(isLogin.value,'is');
	if(isLogin.value){
		uni.navigateTo({
			url:'/pages/news_detail/news_detail?id='+id+'&userId='+user_id
		})
		// console.log('111');
	}else{
		uni.navigateTo({
			url:"/pages/login/login"
		})
	}

}
</script>

<style lang="scss" scoped>
	.gui-item1{
		width: 23%;
	}
.news-card {
    // border-bottom: 1px solid #f8f8f8;
	margin-bottom: 20rpx;
	
border-radius: 16rpx 16rpx 16rpx 16rpx;
    &-content {
        &-title {
            -webkit-line-clamp: 2;
            overflow: hidden;
            word-break: break-all;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
        }
        &-intro {
            -webkit-line-clamp: 1;
            overflow: hidden;
            word-break: break-all;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
        }
    }
}
.card-titel{
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
	font-size: 28rpx;
	font-family: PingFang SC, PingFang SC;
	font-weight: 500;
	color: #333333;
}
.gui{
	display: flex;
	// width: 422rpx;
	font-size: 24rpx;
	font-family: PingFang SC, PingFang SC;
	font-weight: 400;
	color: #777777;
	margin-top: 22rpx;
	
}
.gui-item{
	width: 17%;
}
.huanhang{
	flex: 1;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}
.phone{
	margin-top: 22rpx;
	display: flex;
	font-size: 24rpx;
	font-family: PingFang SC, PingFang SC;
	font-weight: 400;
	color: #333333;
}
.bg-white1{
	background-color: #fff;
}
</style>
